So first if we are going to install Apache Tomcat, we will need to obtain the sources from the site. However, on the apache tomcat download page, there are loads of different packages listed, but it's not immediately clear which one you need to download and install
scroll down to the Tomcat 5 section and grab the jakarta-tomcat-5.0.25-src.tar.gz bundle. Extract the bundle, navigate into the jakarta-tomcat-5 directory and read the BUILDING.txt file. The fist instruction is to install a JDK. This is easily done (if you haven't done it already ) by downloading one of the binary installers from http://java.sun.com/j2se
The next bundle to download is Apache Ant. Not knowing what on earth Apache Ant could be, I trundled over to the web page, which states that "Apache Ant is a Java-based build tool. In theory, it is kind of like Make, but without Make's wrinkles". Well that can't be too difficult, so let's install the latest binary distribution from http://ant.apache.org/bindownload.cgi
Well it looks like the tomcat docs are out of date. Anyway, extract the lump into somewhere useful. I put it under /usr/local/java and my personal preference is to lymlink it to 'ant' with ln -s apache-ant-1.6.1 ant. Then you need to set up your environment so that the scripts can be found - I use the following settings in my shell:
export JAVA_HOME=/usr/local/java
export ANT_HOME=/usr/local/java/ant
# get the java locations into PATH
export PATH=$PATH:/usr/local/java/bin:${JAVA_HOME}:${ANT_HOME}/bin
That last one is important, because it points to the Apache Ant binary directory. This is all documented in tomcat's BUILDING.txt file.
Righty - so now we have installed the Ant thing, let's get back to the tomcat installtion. Still just following the instructions in BUILDING.txt, it looks like we have to download some build.xml file from http://jakarta.apache.org/tomcat/tomcat-5.0-doc/build.xml. We are then told to create a directory and plop the build.xml file inside it. Well I like to do things differently, so I'll do it this way round:
root@brezhnev:/root/$ cd /usr/local/java
root@brezhnev:/usr/local/java$ mkdir tomcat-build
root@brezhnev:/usr/local/java$ cd tomcat-build
root@brezhnev:/usr/local/java/tomcat-build$ wget http://jakarta.apache.org/tomcat/tomcat-5.0-doc/build.xml
Now all we need to do is run 'ant'
So suddenly the billiance of Ant becomes apparent - it's just a clever little application which gets all its build instructions from a single build file (build.xml), which is kinda like a Makefile. the installer then just get's on with it. I can see my system now automatically retrieving bundles from apache.org, extracting them and removing the old archives... eventally the last 3 lines appear:
deploy:
BUILD SUCCESSFUL
Total time: 13 minutes 56 seconds
If you get this far, then you now have a complete Apache Tomcat installation on your system.